<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang='en'>
  <head>
    <title>KRPC::Streaming::Stream</title>
    <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
    <link href='../../../css/style.css' media='screen' rel='stylesheet' type='text/css'>
    <script type='text/javascript'>
      //<![CDATA[
        function popupCode(url) {
          window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
        }
        
        function toggleCode(id) {
          var code = document.getElementById(id)
        
          code.style.display = code.style.display != 'block' ? 'block' : 'none'
          return true
        }
        
        // Make codeblocks hidden by default
        document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
      //]]>
    </script>
  </head>
  <body class='page'>
    <div class='class' id='wrapper'>
      <div class='header'>
        <h1 class='name'>
          <span class='type'>class</span>
          KRPC::Streaming::Stream
        </h1>
        <ol class='paths'>
          <li>
            <a target="docwin" href="../../../files/lib/krpc/streaming_rb.html">lib/krpc/streaming.rb</a>
          </li>
        </ol>
        <div class='parent'>
          Superclass:
          <strong><a target="docwin" href="../../Object.html">Object</a></strong>
        </div>
      </div>
      <div id='content'>
        <div id='text'>
          <div id='description'></div>
          <div id='method-list'>
            <h2>Methods</h2>
            <h3>Public Class</h3>
            <ol>
              <li><a target="docwin" href="#method-c-new">new</a></li>
            </ol>
            <h3>Public Instance</h3>
            <ol>
              <li><a target="docwin" href="#method-i-active-3F">active?</a></li>
              <li><a target="docwin" href="#attribute-i-args">args</a></li>
              <li><a target="docwin" href="#method-i-coderay">coderay</a></li>
              <li><a target="docwin" href="#method-i-get">get</a></li>
              <li><a target="docwin" href="#attribute-i-id">id</a></li>
              <li><a target="docwin" href="#method-i-inspect">inspect</a></li>
              <li><a target="docwin" href="#attribute-i-kwargs">kwargs</a></li>
              <li><a target="docwin" href="#attribute-i-manager">manager</a></li>
              <li><a target="docwin" href="#method-i-mark_as_inactive">mark_as_inactive</a></li>
              <li><a target="docwin" href="#attribute-i-method">method</a></li>
              <li><a target="docwin" href="#method-i-remove">remove</a></li>
              <li><a target="docwin" href="#attribute-i-return_type">return_type</a></li>
              <li><a target="docwin" href="#method-i-to_s">to_s</a></li>
              <li><a target="docwin" href="#attribute-i-value">value</a></li>
            </ol>
          </div>
          <div id='context'>
          </div>
          <div id='section'>
            <div id='aliases-list'>
              <h2>Public Instance Aliases</h2>
              <div class='name-list'>
                <table summary='Public Instance Aliases'>
                  <tr class='top-aligned-row context-row'>
                    <td class='context-item-name'>close</td>
                    <td>-&gt;</td>
                    <td class='context-item-value'><a target="docwin" href="#method-i-remove">remove</a></td>
                  </tr>
                  <tr class='top-aligned-row context-row'>
                    <td class='context-item-name'>value</td>
                    <td>-&gt;</td>
                    <td class='context-item-value'><a target="docwin" href="#method-i-get">get</a></td>
                  </tr>
                </table>
              </div>
            </div>
            <div id='attribute-list'>
              <h2 class='section-bar'>Attributes</h2>
              <div class='name-list'>
                <table>
                  <tr class='top-aligned-row context-row'>
                    <td class='context-item-name'>
                      <a name='attribute-i-args'>args</a>
                    </td>
                    <td class='context-item-value'>[R]</td>
                    <td class='context-item-desc'></td>
                  </tr>
                  <tr class='top-aligned-row context-row'>
                    <td class='context-item-name'>
                      <a name='attribute-i-id'>id</a>
                    </td>
                    <td class='context-item-value'>[R]</td>
                    <td class='context-item-desc'></td>
                  </tr>
                  <tr class='top-aligned-row context-row'>
                    <td class='context-item-name'>
                      <a name='attribute-i-kwargs'>kwargs</a>
                    </td>
                    <td class='context-item-value'>[R]</td>
                    <td class='context-item-desc'></td>
                  </tr>
                  <tr class='top-aligned-row context-row'>
                    <td class='context-item-name'>
                      <a name='attribute-i-manager'>manager</a>
                    </td>
                    <td class='context-item-value'>[R]</td>
                    <td class='context-item-desc'></td>
                  </tr>
                  <tr class='top-aligned-row context-row'>
                    <td class='context-item-name'>
                      <a name='attribute-i-method'>method</a>
                    </td>
                    <td class='context-item-value'>[R]</td>
                    <td class='context-item-desc'></td>
                  </tr>
                  <tr class='top-aligned-row context-row'>
                    <td class='context-item-name'>
                      <a name='attribute-i-return_type'>return_type</a>
                    </td>
                    <td class='context-item-value'>[R]</td>
                    <td class='context-item-desc'></td>
                  </tr>
                  <tr class='top-aligned-row context-row'>
                    <td class='context-item-name'>
                      <a name='attribute-i-value'>value</a>
                    </td>
                    <td class='context-item-value'>[W]</td>
                    <td class='context-item-desc'></td>
                  </tr>
                </table>
              </div>
            </div>
            <div id='methods'>
              <h2>Public Class methods</h2>
              <div class='method public-class' id='method-method-c-new'>
                <a name='method-c-new'></a>
                <div class='synopsis'>
                  <span class='name'>new</span>
                  <span class='arguments'>(manager, id, return_type, value, method, *args, **kwargs)</span>
                </div>
                <div class='description'>
                  
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-c-new-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-c-new-source'><span class="ruby-comment"># File lib/krpc/streaming.rb, line 86</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">manager</span>, <span class="ruby-identifier">id</span>, <span class="ruby-identifier">return_type</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">method</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">**</span><span class="ruby-identifier">kwargs</span>)&#x000A;  <span class="ruby-ivar">@manager</span> = <span class="ruby-identifier">manager</span>&#x000A;  <span class="ruby-ivar">@id</span> = <span class="ruby-identifier">id</span>&#x000A;  <span class="ruby-ivar">@return_type</span>, <span class="ruby-ivar">@value</span> = <span class="ruby-identifier">return_type</span>, <span class="ruby-identifier">value</span>&#x000A;  <span class="ruby-ivar">@method</span>, <span class="ruby-ivar">@args</span>, <span class="ruby-ivar">@kwargs</span> = <span class="ruby-identifier">method</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">kwargs</span>&#x000A;  <span class="ruby-ivar">@active</span> = <span class="ruby-keyword">true</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <h2>Public Instance methods</h2>
              <div class='method public-instance' id='method-method-i-active-3F'>
                <a name='method-i-active-3F'></a>
                <div class='synopsis'>
                  <span class='name'>active?</span>
                  <span class='arguments'>()</span>
                </div>
                <div class='description'>
                  
                  <p>Check if stream is active (i.e. not removed).</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-active-3F-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-active-3F-source'><span class="ruby-comment"># File lib/krpc/streaming.rb, line 108</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">active?</span>; <span class="ruby-ivar">@active</span> <span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-coderay'>
                <a name='method-i-coderay'></a>
                <div class='synopsis'>
                  <span class='name'>coderay</span>
                  <span class='arguments'>(x)</span>
                </div>
                <div class='description'>
                  
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-coderay-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-coderay-source'><span class="ruby-comment"># File lib/krpc/streaming.rb, line 119</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">coderay</span>(<span class="ruby-identifier">x</span>)&#x000A;  <span class="ruby-identifier">require</span> <span class="ruby-string">&#39;coderay&#39;</span>&#x000A;  <span class="ruby-keyword">if</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>) <span class="ruby-keyword">then</span> <span class="ruby-string">&quot;[&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Gen</span><span class="ruby-operator">::</span><span class="ruby-constant">ClassBase</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">inspect</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">coderay</span>(<span class="ruby-identifier">e</span>.<span class="ruby-identifier">inspect</span>)}.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;, &quot;</span>) <span class="ruby-operator">+</span> <span class="ruby-string">&quot;]&quot;</span>&#x000A;  <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-keyword">then</span> <span class="ruby-string">&quot;{&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">coderay</span>(<span class="ruby-identifier">k</span>.<span class="ruby-identifier">inspect</span>) <span class="ruby-operator">+</span> <span class="ruby-string">&quot;=&gt;&quot;</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">v</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Gen</span><span class="ruby-operator">::</span><span class="ruby-constant">ClassBase</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">inspect</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">coderay</span>(<span class="ruby-identifier">v</span>.<span class="ruby-identifier">inspect</span>))}.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;, &quot;</span>) <span class="ruby-operator">+</span> <span class="ruby-string">&quot;}&quot;</span>&#x000A;  <span class="ruby-keyword">else</span> <span class="ruby-constant">CodeRay</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">x</span>, <span class="ruby-value">:ruby</span>).<span class="ruby-identifier">term</span> <span class="ruby-keyword">end</span>&#x000A;<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span>&#x000A; <span class="ruby-identifier">x</span>.<span class="ruby-identifier">inspect</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-get'>
                <a name='method-i-get'></a>
                <div class='synopsis'>
                  <span class='name'>get</span>
                  <span class='arguments'>()</span>
                </div>
                <div class='description'>
                  
                  <p>Get the current stream value. Has alias method <code>value</code>.</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-get-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-get-source'><span class="ruby-comment"># File lib/krpc/streaming.rb, line 95</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">get</span>&#x000A;  <span class="ruby-identifier">raise</span> <span class="ruby-ivar">@value</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@value</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Exception</span>)&#x000A;  <span class="ruby-ivar">@value</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-inspect'>
                <a name='method-i-inspect'></a>
                <div class='synopsis'>
                  <span class='name'>inspect</span>
                  <span class='arguments'>()</span>
                </div>
                <div class='description'>
                  
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-inspect-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-inspect-source'><span class="ruby-comment"># File lib/krpc/streaming.rb, line 118</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">inspect</span>&#x000A;  <span class="ruby-keyword">def</span> <span class="ruby-identifier">coderay</span>(<span class="ruby-identifier">x</span>)&#x000A;    <span class="ruby-identifier">require</span> <span class="ruby-string">&#39;coderay&#39;</span>&#x000A;    <span class="ruby-keyword">if</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Array</span>) <span class="ruby-keyword">then</span> <span class="ruby-string">&quot;[&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Gen</span><span class="ruby-operator">::</span><span class="ruby-constant">ClassBase</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">inspect</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">coderay</span>(<span class="ruby-identifier">e</span>.<span class="ruby-identifier">inspect</span>)}.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;, &quot;</span>) <span class="ruby-operator">+</span> <span class="ruby-string">&quot;]&quot;</span>&#x000A;    <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-keyword">then</span> <span class="ruby-string">&quot;{&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">coderay</span>(<span class="ruby-identifier">k</span>.<span class="ruby-identifier">inspect</span>) <span class="ruby-operator">+</span> <span class="ruby-string">&quot;=&gt;&quot;</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">v</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Gen</span><span class="ruby-operator">::</span><span class="ruby-constant">ClassBase</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">inspect</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">coderay</span>(<span class="ruby-identifier">v</span>.<span class="ruby-identifier">inspect</span>))}.<span class="ruby-identifier">join</span>(<span class="ruby-string">&quot;, &quot;</span>) <span class="ruby-operator">+</span> <span class="ruby-string">&quot;}&quot;</span>&#x000A;    <span class="ruby-keyword">else</span> <span class="ruby-constant">CodeRay</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">x</span>, <span class="ruby-value">:ruby</span>).<span class="ruby-identifier">term</span> <span class="ruby-keyword">end</span>&#x000A;  <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span>&#x000A;   <span class="ruby-identifier">x</span>.<span class="ruby-identifier">inspect</span>&#x000A;  <span class="ruby-keyword">end</span>&#x000A;  <span class="ruby-node">&quot;#&lt;#{self.class}&quot;</span>.<span class="ruby-identifier">green</span> <span class="ruby-operator">+</span>&#x000A;      <span class="ruby-string">&quot; @id&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;=&quot;</span>.<span class="ruby-identifier">green</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">id</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">bold</span>.<span class="ruby-identifier">blue</span> <span class="ruby-operator">+</span>&#x000A;      <span class="ruby-string">&quot; @active&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;=&quot;</span>.<span class="ruby-identifier">green</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@active</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">bold</span>.<span class="ruby-identifier">light_cyan</span> <span class="ruby-operator">+</span>&#x000A;      <span class="ruby-string">&quot;\n\t@method&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;=&quot;</span>.<span class="ruby-identifier">green</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">inspect</span>.<span class="ruby-identifier">green</span> <span class="ruby-operator">+</span>&#x000A;      (<span class="ruby-identifier">args</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">?</span> <span class="ruby-string">&quot;&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;\n\t@args&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;=&quot;</span>.<span class="ruby-identifier">green</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">coderay</span>(<span class="ruby-identifier">args</span>)) <span class="ruby-operator">+</span>&#x000A;      (<span class="ruby-identifier">kwargs</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">?</span> <span class="ruby-string">&quot;&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;\n\t@kwargs&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;=&quot;</span>.<span class="ruby-identifier">green</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">coderay</span>(<span class="ruby-identifier">kwargs</span>)) <span class="ruby-operator">+</span>&#x000A;      <span class="ruby-string">&quot;\n\treturn_ruby_type&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-string">&quot;=&quot;</span>.<span class="ruby-identifier">green</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">coderay</span>(<span class="ruby-identifier">return_type</span>.<span class="ruby-identifier">ruby_type</span>) <span class="ruby-operator">+</span>&#x000A;      <span class="ruby-string">&quot;&gt;&quot;</span>.<span class="ruby-identifier">green</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-mark_as_inactive'>
                <a name='method-i-mark_as_inactive'></a>
                <div class='synopsis'>
                  <span class='name'>mark_as_inactive</span>
                  <span class='arguments'>()</span>
                </div>
                <div class='description'>
                  
                  <p>Mark stream as inactive. WARNING: This method does not remove the stream.
                  To remove the stream call <a href="Stream.html#method-i-remove">#remove</a>
                  instead.</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-mark_as_inactive-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-mark_as_inactive-source'><span class="ruby-comment"># File lib/krpc/streaming.rb, line 112</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">mark_as_inactive</span>; <span class="ruby-ivar">@active</span> = <span class="ruby-keyword">false</span> <span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-remove'>
                <a name='method-i-remove'></a>
                <div class='synopsis'>
                  <span class='name'>remove</span>
                  <span class='arguments'>()</span>
                </div>
                <div class='description'>
                  
                  <p>Remove stream. Has alias method <code>close</code>.</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-remove-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-remove-source'><span class="ruby-comment"># File lib/krpc/streaming.rb, line 102</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">remove</span>&#x000A;  <span class="ruby-identifier">manager</span>.<span class="ruby-identifier">remove_stream</span> <span class="ruby-keyword">self</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-to_s'>
                <a name='method-i-to_s'></a>
                <div class='synopsis'>
                  <span class='name'>to_s</span>
                  <span class='arguments'>()</span>
                </div>
                <div class='description'>
                  
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-to_s-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-to_s-source'><span class="ruby-comment"># File lib/krpc/streaming.rb, line 114</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>&#x000A;  <span class="ruby-identifier">inspect</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/\n|\t/</span>,<span class="ruby-string">&quot; &quot;</span>).<span class="ruby-identifier">squeeze</span>(<span class="ruby-string">&quot; &quot;</span>).<span class="ruby-identifier">uncolorize</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div id='footer-push'></div>
    </div>
    <div id='footer'>
      <a target="docwin" href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
    </div>
  </body>
</html>
